#pragma once
#include "MovingObject.h"
#include "stdafx.h"
#include "Emitter.h"
class Weapon;

class Projectile : public MovingObject
{
public:
	Projectile() = default;
	virtual ~Projectile();

	/**********************************************************/
	// Interface:
	//	- virtual functions for children classes to override
	virtual void	Update(float elapsedTime)		override;
		virtual void	Render(void)					override;

	//	virtual SGD::Rectangle GetRect(void)	const			override;
	virtual int		GetType(void)	const			override	{ return OBJ_BULLET; }
	virtual void	HandleCollision(GameObject* pOther)	override;
//	virtual void	HandleEvent(const SGD::Event* pEvent) override;
	MovingObject * GetOwner(void) const { return m_goOwner; }
	void SetOwner(MovingObject * own) { m_goOwner = own; }
	float GetBulletSpeed() { return m_fBulletSpeed; }
	int GetTick() const { return tick; }
	bool GetExploded() const { return exploded; }

	void SetRange(int rng) { m_iRange = rng; }
	void SetRangeMax(int range) { m_iRangeMax = range; }
	void SetDamage(int dmg) { m_iDamage = dmg; }
	void SetDoubleDamage(int dmg) { m_iDoubleDamage = dmg; }
	void SetBulletType(int enumid) { m_iBulletType = enumid; }
	void SetBulletSpeed(float speed) { m_fBulletSpeed = speed; }
	void SetShotStyle(int enumid) { m_iShotStyle = enumid; }
	void SetOwnerVel(float ownervel) { m_fOwnersShootingVelocity = ownervel; }
	void NormalUpdate(float elapsedTime);
	int GetDamage(void) const { return m_iDamage; }

protected:
	MovingObject * m_goOwner = nullptr;
	int m_iRange = 0;
	int m_iRangeMax = 0;
	int m_iDamage = 0;
	int m_iDoubleDamage = 0;
	float m_fOwnersShootingVelocity = 0;
	float m_fTimeAlive = 0;
	float m_fBulletSpeed = 600.0f;
	int m_iBulletType = 0; // enum in weapon
	int m_iShotStyle = 0; // enum in weapon
	bool m_bReturning = false;
	bool m_bHasMirrored = false;
	MovingObject* m_pTarget = nullptr;
	bool exploded = false;
	int tick = 0;
};
